import { _decorator, Camera, Component, v3, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('envObject')
export class envObject extends Component {
    @property(Camera) mainCamera: Camera = null

    start() {
        // this.node.setRotationFromEuler(v3(35, 0, 0))
    }

    _rotationV3: Vec3 = v3()
    update(deltaTime: number) {
        let cameraRoot = this.mainCamera.node.parent
        this._rotationV3 = cameraRoot.eulerAngles
        //物体始终朝向 摄像机
        let cameraRotationX = cameraRoot.eulerAngles.x
        //保持旋转角度
        let cameraRotationZ = cameraRoot.eulerAngles.z
        this.node.setRotationFromEuler(v3(45, 0, cameraRotationZ))
    }

}


